<template>
    <div class="center">
        <div class="left">
            <el-icon>

            </el-icon>
            <span>数据列表</span>
        </div>
    </div>
    <div class="bottom">
        <el-table :data="tableData" style="width: 100%" :border="true">
            <el-table-column prop="id" style="text-align: center;" label="编号" width="100">
            </el-table-column>
            <el-table-column prop="name" style="text-align: center;" label="秒杀时间段名称" width="334">
            </el-table-column>
            <el-table-column label="每日开始时间" width="332">
                <template #default="scope">
                    {{ scope.row.startTime
                        ? dayjs(scope.row.startTime
                        ).format('YYYY-MM-DD HH:mm:ss') : '' }}</template>
            </el-table-column>
            <el-table-column label="每日结束时间" width="332">
                <template #default="scope">
                    {{ scope.row.endTime
                        ? dayjs(scope.row.endTime
                        ).format('YYYY-MM-DD HH:mm:ss') : '' }}</template>
            </el-table-column>
            <el-table-column prop="productCount" label="商品数量" width="169">
            </el-table-column>
            <el-table-column label="操作" width="180" flex="right">
                <template #default="scope">
                    <el-button link type="primary" size="small" @click="splb(scope.row)">商品列表</el-button>
                </template>
            </el-table-column>
        </el-table>
    </div>
</template>

<script setup lang="ts">
import dayjs from 'dayjs'
import * as api from '../../json/request/api'
import { onMounted, ref } from 'vue';
import { useRoute } from 'vue-router'
import type { selectRes, flashProductRelationCS } from '../../json/request/QmsAdminConreiller/index'
import router from '../../router';
let route: any = useRoute()
console.log(route.query.id);
let tableData = ref<selectRes[]>([])
onMounted(async () => {
    let res = await api.admin.selectQQ(route.query.id)
    console.log(res);
    tableData.value = res

})

// splb商品列表
let splb = async (data: selectRes) => {
    // let res =await api.admin.flashProductRelationQQ()
    router.push(`/sms/flashProductRelation?flashPromotionId=${route.query.id}&flashPromotionSessionId=${data.id}`)
}
</script>

<style scoped lang="scss">
.center {
    margin-top: 15px;
    display: flex;
    justify-content: space-between;
    border-radius: 4px;
    border: 1px solid #ebeef5;
    background-color: #fff;
    overflow: hidden;
    padding: 20px;
    align-items: center;
}
</style>